// components/information-input/information-input.ts
Component({

  /**
   * 组件的属性列表
   */
  lifetimes: {
    attached: function () {
      this.setData({
        textValue: this.properties.value
      })
    }
  },
  properties: {
    value: {
      type: String,
      value: "",
    },
    tip: {
      type: String,
      value: "",
    },
    maxLength: {
      type: Number,
      value: 20,
    },
    label: {
      type: String,
      value: "",
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    textValue: ""
  },

  /**
   * 组件的方法列表
   */
  methods: {
    handleInput(e: any) {
      const { value } = e.detail
      this.setData({
        textValue: value
      })
    },
    handleCancle() {
      this.triggerEvent("inputCancle")
    },
    handleConfirm() {
      this.triggerEvent("inputConfirm", {
        data: this.data.textValue
      })
    }
  }
})